<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" lang="en">
<meta charset="utf-8">
<head>
    <meta charset="utf-8">
    <title>论坛</title>
	<link rel="stylesheet" href="/css/bootstrap.min.css">
	<link rel="stylesheet" href="/css/index.css">
	<!-- 可选的 Bootstrap 主题文件（一般不用引入） -->
	<link href="/css/materialdesignicons.min.css" rel="stylesheet">
	<link href="/css/style.min.css" rel="stylesheet">
	<script src="/js/jquery.min.js"></script>
	<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
	<script src="/js/bootstrap.min.js"></script>
</head>
<body class="body">
<!--导入navigation.html，内容是导航框-->
<div th:insert="~{navigation :: copy}"></div>
<!--首页展示的发现部分-->
<div class="container-fluid main">
    <div class="row">
        <div class="col-lg-9 col-md-12 col-sm-12 col-ss-12">
            <h2><span class="mdi mdi-infinity" aria-hidden="true"></span> 发现 </h2>
            <hr>
            <!--分页展示内容-->
            <div class="media" th:each="question:${questionIPage.getRecords()}" style="margin-top: 22px">
                <div class="media-left">
                    <a th:href="@{'/question/'+${question.id}}">
                        <img class="media-object img-circle picset"
                             th:src="${question.tbStu.stuImg}">
                    </a>
                </div>
                <div class="media-body">
                    <span style="margin-top: 10px;">
                        <h4 class="media-heading" style="font-size: 17px;">
                        <a th:href="@{'/question/'+${question.id}}" th:text="${question.title}"></a>
                        </h4>
                    </span>
                    <span class="common-list">
                    <span th:text="${question.commentCount}"/> 个评论 • <span
                            th:text="${question.viewCount}"/> 次浏览 • <span th:text="${question.likeCount}"/>个点赞
                        <span th:text="${#temporals.format(question.createtime,'yyyy-MM-dd HH:mm:ss')}" style="float: right;"></span></span>
                </div>
            </div>

			<form class="pull-right search-bar" action='/index' id="form3" method='post' role="form">
				<input type="hidden" name="page" id="pageNo" th:value="${page}">
			</form>
			<div class="pagination">

				<div id="myPage">

				</div>
				<link rel="stylesheet" type="text/css" href="/js/page/jquery.sPage.css">
				<script type="text/javascript"
						src="/js/jquery.min.js"></script>
				<script type="text/javascript"
						src="/js/page/jquery.sPage.min.js"></script>
				<script type="text/javascript" th:inline="javascript">
                    //初始化分页组件

                    $("#myPage").sPage({

                        page:[[${page}]],//当前页码，必填
                        total:[[${questionIPage.getTotal()}]],//数据总条数，必填
                        pageSize:[[${questionIPage.getSize()}]],//每页显示多少条数据，默认10条
                        totalTxt:"共"+[[${questionIPage.getTotal()}]]+"条",//数据总条数文字描述，{total}为占位符，默认"共{total}条"
                        showTotal:true,//是否显示总条数，默认关闭：false
                        showSkip:true,//是否显示跳页，默认关闭：false
                        showPN:true,//是否显示上下翻页，默认开启：true
                        prevPage:"上一页",//上翻页文字描述，默认“上一页”
                        nextPage:"下一页",//下翻页文字描述，默认“下一页”
                        backFun:function(page){
                            //点击分页按钮回调函数，返回当前页码
                            console.log(page);
                            $("#pageNo").val(page);
                            $("#form3").submit();
                        }
                    });

                    //回调方法:点击上一页和下一页
                    function handlePaginationClick(new_page_index, pagination_container) {
                        $("#pageNo").val(new_page_index + 1);
                        $("#form3").submit();
                    }

				</script>

			</div>
        </div>
        <!--热门话题部分-->
        <div class="col-lg-3 col-md-12 col-sm-12 col-ss-12">
            <h3>链接</h3>
            <a href="http://www.lynu.edu.cn/">
                <img class="adminicon" src="/img/lynu.png" alt="洛阳师范学院">
            </a>
            <a href="http://211.67.81.71/jwweb/home.aspx">
                <img class="adminicon" src="/img/qq.jpg" alt="洛阳师范学院教务系统"/>
            </a>
            <hr>
            <h3>热门话题</h3>
            <ul class="list-group">
                <li class="list-group-item"  th:each="question:${tbQuestions}">
                    <a th:href="@{'/question/'+${question.id}}" th:text="${question.title}"></a>
                </li>
            </ul>

        </div>
    </div>
</div>
</body>
</html>